import axios from 'axios'
const request = axios.create({
  baseURL: 'http://172.20.10.9:5000/',
  timeout: 60000
})
request.interceptors.request.use(
  (config) => config,
  (error) => Promise.reject(error)
)
request.interceptors.response.use(
  (response) => {
    if (response.data.code === 200) return response.data
    else return Promise.reject(new Error(response.data.message || '请求失败'))
  },
  (error) => Promise.reject(error)
)
export default request